<?php

function generate_sig($params_array, $secret) {
    $str = '';

    ksort($params_array);
    // Note: make sure that the signature parameter is not already included in
    //       $params_array.
    foreach ($params_array as $k=>$v) {
      $str .= "$k=$v";
    }
    $str .= $secret;

    return md5($str);
  }
  
  
$appapikey = '3e99105ed5c922110fb95eeb507e1599';
$appsecret = 'fa104a2e1f7d83328599406adbe7cbf1';


$args = array(
'api_key' => $appapikey,
'method'=>"auth.createToken",
'v'=>"1.0");

$sig =generate_sig($args,$appsecret);
//echo $sig;
echo "http://facebook.com/restserver.php?api_key=".$appapikey."&method=".$args['method']."&v=".$args['v']."&sig=".$sig;